<html>
<head><meta charset="utf-8"><title>rustfix replace or AST MutVisitor · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rustfix.20replace.20or.20AST.20MutVisitor.html">rustfix replace or AST MutVisitor</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="234066211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rustfix%20replace%20or%20AST%20MutVisitor/near/234066211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BaSh <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rustfix.20replace.20or.20AST.20MutVisitor.html#234066211">(Apr 11 2021 at 18:36)</a>:</h4>
<p>I would like to replace a <code>ident</code> name from x to y based on the span information(I cannot use Syn + quote). A minimal source to source transformation. is it better to use logic like <code>rustfix</code> replace or to do a AST mutation using collected <code>span</code> information?</p>



<a name="234074111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rustfix%20replace%20or%20AST%20MutVisitor/near/234074111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rustfix.20replace.20or.20AST.20MutVisitor.html#234074111">(Apr 11 2021 at 20:40)</a>:</h4>
<p>rustfix works by applying <code>span_suggestion</code>s, it doesn't have its own framework really</p>



<a name="234117063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rustfix%20replace%20or%20AST%20MutVisitor/near/234117063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BaSh <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rustfix.20replace.20or.20AST.20MutVisitor.html#234117063">(Apr 12 2021 at 07:48)</a>:</h4>
<p>True, I was planning to re-use the rust-fix logic.  I guess I will try both and see.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>